-- card: 2063 from stack: in.7 -- bmap block id: 2328 -- flags: 0000 -- background id: 10029 -- name: ----- HyperTalk script ----- -- ShowMe -- THIS VERSION FOR WINDOID DEMO PURPOSES ONLY. -- DO NOT PASTE IT INTO YOUR HOME STACK. -- ShowMe makes a list of all the objects of the current -- card and background and puts them in a card field named -- "objects list". Copy this script into your Home stack, -- then you can type "showme" into the message box while -- you're looking at any card. on showMe set cursor to 4 -- wristwatch or set cursor to watch in 1.2.1. -- "objectNames" will be the variable we'll load up to contain -- the names of the objects on the card. -- First, the title: put "Objects of " & the name of this card & return & return into objectNames -- BACKGROUND FIELDS -- Then, we get the field names (if any). if the number of fields <> 0 then repeat with i = 1 to the number of fields -- in order to tell whether a field is hidden or not, we’ll -- use a variable called "showing". We'll begin by making it -- empty. put empty into showing -- Now, for each field, we're putting either nothing or "hidden" -- into "showing". if not the visible of field i then put "[hidden]" into showing -- The construction "not the visible of field i" resolves to -- either true or false depending whether the field is hidden -- or visible. -- Now we add the field name, whether it is visible or not, and a -- return to our variable "objectNames". put the name of field i && showing & return after objectNames end repeat end if -- Here, we're going to write a "graphic" element to indicate the -- end of the list of fields. put "=====" & return after objectNames -- BACKGROUND BUTTONS -- Using the same routine we did for the background fields: if the number of background buttons <> 0 then repeat with i = 1 to the number of bkgnd buttons put empty into showing if not the visible of background button i then put "[hidden]" into showing put the name of background button i && showing & return after objectNames end repeat end if -- again, this is the graphic element that indicates the end -- of the list of background buttons. put "=====" & return after objectNames -- CARD FIELDS if the number of card fields <> 0 then repeat with i = 1 to the number of card fields put empty into showing if not the visible of card field i then put "[hidden]" into showing put the name of card field i && showing & return after objectNames end repeat end if put "=====" & return after objectNames -- CARD BUTTONS if the number of buttons <> 0 then repeat with i = 1 to the number of buttons put empty into showing if not the visible of button i then put "[hidden]" into showing put the name of button i && showing & return after OBJECTNAMES end repeat end if -- PUTTING THE LIST INTO A CARD FIELD -- Okay, we've got the entire list of objects. Now, we -- check the list to see if it already contains a card field -- named "object list". If it does, then we put our list into -- that field and we're done. If it does not, then we make -- the new card field on the fly and put our list into it. if OBJECTNAMES contains "object list" then put OBJECTNAMES & return & return into card field "object list" show card field "object list" exit showMe end if -- MAKING A NEW CARD FIELD doMenu "new field" -- makes a new card field -- Since new cards are unnamed (unlike buttons, which get the -- name "new button"), we'll refer to the field by number. If -- we already had, for example, three card fields on the card, -- our new field will be number 4. Rather than keep track of -- how many card fields we have on this card, we simply refer -- to the function, number of, knowing that the number of -- card fields has been increased by one. We could write: -- get the number of card fields -- then use that number to refer to our new field. But, -- more directly, we simply put "the number of card fields" -- in parentheses where we want HyperCard to count the card -- fields, and we end up with: set name of card field (the number of card fields) to "object list" -- Now that we have a name for our new card field, we can refer -- to it by its name. Next step is to tell HyperCard -- what the properties of the field should be. set rect of card field "object list" to 0,0,258,342 set style of card field "object list" to scrolling set textfont of card field "object list" to geneva set textsize of card field "object list" to 9 -- Now we put our variable into the field. put OBJECTNAMES into card field "object list" -- The field that we’ve drawn on the card is pretty big. It -- stretches from the upper left corner to about 1/3 of -- the way across the card at the bottom. If we want to see -- what's underneath the scrolling field, we have to hide -- the field. So, we put a handler in the field’s script -- that lets us do that. This handler hides "the target" -- (the object that got the mouseUp message) and also -- puts a command into the message box, ready for us to -- type a return. That command shows the hidden field again. put "on mouseUp" & return & "choose field tool" & return & "select me" & return & "doMenu" && quote & "Clear Field" & quote & return & "choose browse tool" & return & "end mouseUp" & return into temp -- I put the script into the variable "temp" first, -- so the next line of HyperTalk code will be simple -- and straightforward. set script of card field "object list" to temp -- Now we lock the field so we can click on it. set locktext of card field "object list" to true -- And we’re all done, so let’s get back to our browsing. choose browse tool end showMe on closeCard get the number of cd flds if it = 3 then lock screen choose field tool select cd fld 3 doMenu "Clear Field" choose browse tool unlock screen end if end closeCard -- part 1 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=76 top=211 right=242 bottom=107 -- title width / last selected line: 0 -- icon id / first selected line: 31761 / 31761 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ----- HyperTalk script ----- on mouseUp set the hilight of me to not the hilight of me set the visible of cd fld 2 to not the visible of cd fld 2 end mouseUp -- part 2 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=6 top=214 right=239 bottom=77 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 65535 -- font id: 20 -- text size: 12 -- style flags: 8192 -- line height: 12 -- part name: ----- HyperTalk script ----- on mouseUp send mouseUp to cd btn 1 end mouseUp -- part 3 (field) -- low flags: 81 -- high flags: 2007 -- rect: left=114 top=208 right=319 bottom=296 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 20 -- text size: 12 -- style flags: 0 -- line height: 13 -- part name: ----- HyperTalk script ----- on mouseUp send mouseUp to cd btn 1 end mouseUp -- part contents for background part 11 ----- text ----- • I recently had the pleasure of developing a set of 19 stacks for a client. These stacks were moderately complex, including a context-sensitive help system using hidden fields and buttons. It was easy to lose track of which objects we'd already put on the cards, so I wrote this script to add to the handlers in my Home stack script. Now I can simply type "showMe" into the message box in any stack, and HyperCard will come back with a list of all the objects (including hidden objects) on the card I'm looking at and put the list into a card field that the script draws for that purpose. Editor's Note: Option-Return looks like this: ¬ __________________________________________________________ -- ShowMe -- 3/24/88 version 0.4 -- ShowMe makes a list of all the objects of the current -- card and background and puts them in a card field named -- "objects list". Copy this script into your Home stack, -- then you can type "showme" into the message box while -- you're looking at any card. on showMe set cursor to 4 -- wristwatch or set cursor to watch in 1.2.1. -- "objectNames" will be the variable we'll load up to contain -- the names of the objects on the card. -- First, the title: put "Objects of " & the name of this card & return & return ¬ into objectNames -- BACKGROUND FIELDS -- Then, we get the field names (if any). if the number of fields <> 0 then repeat with i = 1 to the number of fields -- in order to tell whether a field is hidden or not, we’ll -- use a variable called "showing". We'll begin by making it -- empty. put empty into showing -- Now, for each field, we're putting either nothing or "hidden" -- into "showing". if not the visible of field i then put "[hidden]" into showing -- The construction "not the visible of field i" resolves to -- either true or false depending whether the field is hidden -- or visible. -- Now we add the field name, whether it is visible or not, and a -- return to our variable "objectNames". put the name of field i && showing & return after objectNames end repeat end if -- Here, we're going to write a "graphic" element to indicate the -- end of the list of fields. put "=====" & return after objectNames -- BACKGROUND BUTTONS -- Using the same routine we did for the background fields: if the number of background buttons <> 0 then repeat with i = 1 to the number of bkgnd buttons put empty into showing if not the visible of background button i then ¬ put "[hidden]" into showing put the name of background button i && ¬ showing & return after objectNames end repeat end if -- again, this is the graphic element that indicates the end -- of the list of background buttons. put "=====" & return after objectNames -- CARD FIELDS if the number of card fields <> 0 then repeat with i = 1 to the number of card fields put empty into showing if not the visible of card field i then ¬ put "[hidden]" into showing put the name of card field i && showing & return ¬ after objectNames end repeat end if put "=====" & return after objectNames -- CARD BUTTONS if the number of buttons <> 0 then repeat with i = 1 to the number of buttons put empty into showing if not the visible of button i then ¬ put "[hidden]" into showing put the name of button i && showing & ¬ return after OBJECTNAMES end repeat end if -- PUTTING THE LIST INTO A CARD FIELD -- Okay, we've got the entire list of objects. Now, we -- check the list to see if it already contains a card field -- named "object list". If it does, then we put our list into -- that field and we're done. If it does not, then we make -- the new card field on the fly and put our list into it. if OBJECTNAMES contains "object list" then put OBJECTNAMES & return & return into card field "object list" show card field "object list" exit showMe end if -- MAKING A NEW CARD FIELD doMenu "new field" -- makes a new card field -- Since new cards are unnamed (unlike buttons, which get the -- name "new button"), we'll refer to the field by number. If -- we already had, for example, three card fields on the card, -- our new field will be number 4. Rather than keep track of -- how many card fields we have on this card, we simply refer -- to the function, number of, knowing that the number of -- card fields has been increased by one. We could write: -- get the number of card fields -- then use that number to refer to our new field. But, -- more directly, we simply put "the number of card fields" -- in parentheses where we want HyperCard to count the card -- fields, and we end up with: set name of card field (the number of card fields) to "object list" -- Now that we have a name for our new card field, we can refer -- to it by its name. Next step is to tell HyperCard -- what the properties of the field should be. set rect of card field "object list" to 0,0,258,342 set style of card field "object list" to scrolling set textfont of card field "object list" to geneva set textsize of card field "object list" to 9 -- Now we put our variable into the field. put OBJECTNAMES into card field "object list" -- The field that we’ve drawn on the card is pretty big. It -- stretches from the upper left corner to about 1/3 of -- the way across the card at the bottom. If we want to see -- what's underneath the scrolling field, we have to hide -- the field. So, we put a handler in the field’s script -- that lets us do that. This handler hides "the target" -- (the object that got the mouseUp message) and also -- puts a command into the message box, ready for us to -- type a return. That command shows the hidden field again. put "on mouseUp" & return &¬ "hide the target" & return &¬ "put" && quote & "show" & quote && " && the name of the target" ¬ & return & "end mouseUp" & return into temp -- I put the script into the variable "temp" first, -- so the next line of HyperTalk code will be simple -- and straightforward. set script of card field "object list" to temp -- Now we lock the field so we can click on it. set locktext of card field "object list" to true -- And we’re all done, so let’s get back to our browsing. choose browse tool end showMe  -- part contents for background part 17 ----- text ----- ShowMe: a Home Stack Script -- part contents for background part 18 ----- text ----- • by Paul Foraker -- part contents for card part 2 ----- text ----- how to try ShowMe -- part contents for card part 3 ----- text ----- about SHOWME • WINDOID stack design note _________________________ • You can test the script by typing "showMe" into the message box while on this card. • The ShowMe demo's "objects" field will be deleted when you click it with the mouse, or if you leave this card (a normal ShowMe field will just hide itself if you click it). This resets the demo so you can try it again and again until you get really bored. • Copy the ShowMe script from the scrolling field above to paste into your Home stack script. Don't copy the demo version in this card's script container; it has been slightly modified (to implement the demo's self-deletion characteristic), and doesn't behave quite the way Mr. Foraker intended it to.  -- part contents for background part 19 ----- text ----- volume 1 • number 7 • card 5 •